home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / DO5-Unpack_kat.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-26  |  3KB  |  119 lines

  1. /*
  2.   $VER: DO5-Unpack_kat.rexx 1.0 (19.12.95) Georges 'Melkor' Goncalves
  3.   Written by Georges 'Melkor' Goncalves and Eric Sauvageau.
  4.  
  5.   ARexx Script for DOpus 5 to decrunch selected files via XPKatana.
  6.  
  7.   Usage:
  8.  
  9.   <ARexx>   DO5-Unpack_kat.rexx
  10.  
  11.   Note: XPKatana is copyright © Eric Sauvageau and it does NOT belong to the
  12.         DOpus5 distribution. It's ShareWare.
  13.  
  14. */
  15.  
  16. OPTIONS RESULTS
  17. OPTIONS FAILAT 25
  18.  
  19. /* Adjust this as needed */
  20. XPKATANA_PATH = "SYS:Utilities/XPKatana"
  21.  
  22. /* Should check if DOpus is really there */
  23.  
  24.   If ~SHOW('p',"DOPUS.1") Then Do
  25.      Say "This script should be used with DirectoryOpus running!"
  26.  
  27.      Exit 20
  28.   End
  29.  
  30. /* We have to actually verify is XPKatana is running.          */
  31.   If ~SHOW('p',"KATANA") Then Do
  32.  
  33. /* IF XPKatana is not already running, start it !                     */
  34.       started = 1
  35.       Address Command "run <>NIL: "||XPKATANA_PATH||" ICONIFY"
  36.       Address Command "WaitForPort KATANA"
  37.   End
  38.  
  39. address 'DOPUS.1'
  40.  
  41. lister query source /* Is there any source lister ? */
  42. SRCHandle=RESULT
  43.  
  44. if SRCHandle="RESULT" Then Do
  45.   dopus request '"You need a source lister to use this script :-)" Damn!'
  46.  
  47.   Address 'KATANA'
  48.   If started = 1 Then Do
  49.      Quit
  50.   End
  51.   Exit 0
  52. end
  53.  
  54.  
  55. lister query SRCHandle selfiles  /* Returns the name of selected files separated by space */
  56. Files=RESULT
  57.  
  58. lister query SRCHandle numselfiles ; selected = result
  59.  
  60. if selected=0 Then Do
  61.   dopus request '"No source file(s) selected!" Damn!'
  62.  
  63.   Address 'KATANA'
  64.   If started = 1 Then Do
  65.      Quit
  66.   End
  67.  
  68.   Exit 0
  69. end
  70.  
  71. /* Busy the lister */
  72. lister set SRCHandle busy 1
  73.  
  74.  
  75. lister query SRChandle path  /* Returns the source path */
  76. Path = RESULT
  77.  
  78. Address 'KATANA'
  79.  
  80. GetFlag NOPROGRESS ; oldflag = result
  81. SetFlags NOPROGRESS 1
  82.  
  83. Do Forever
  84.    Parse Var Files afile Files   /* Pull the first file and keep the remain */
  85.    If afile == '' Then Leave
  86.    completefile = path||Strip(afile,'B','"')   /* Add path, strip "" */
  87.  
  88.    SetSource completefile
  89.    UnPack  ; error = result 
  90.  
  91.    /* Un-select the processed file */
  92.    Address 'DOPUS.1' 
  93.  
  94.    Address 'DOPUS.1' 
  95.    If error = 'ABORT' Then Do
  96.       dopus request '"Error while unpacking "'||afile||'"!" Damn!'
  97.    End
  98.  
  99.    lister select SRCHandle afile off
  100.  
  101.    Address 'KATANA'  /* Switch back to the Katana port */
  102. End
  103.  
  104.  
  105. /* If we started XPKatana, close it down */
  106. If started = 1 Then Do
  107.    Quit
  108. End
  109. Else Do
  110.    SetFlags NOPROGRESS oldflag
  111. End
  112.  
  113.  
  114. /* Update lister */
  115. Address 'DOPUS.1'
  116.  
  117. lister set SRCHandle busy 0              /* Un-busy the lister */
  118. lister refresh SRChandle
  119.